\(\int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx\) [41]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 24, antiderivative size = 49 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx=-a^3 x+\frac {i a^3 \log (\cos (c+d x))}{d}-\frac {2 i a^4}{d (a-i a \tan (c+d x))} \]

[Out]

-a^3*x+I*a^3*ln(cos(d*x+c))/d-2*I*a^4/d/(a-I*a*tan(d*x+c))

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {3568, 45} \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx=-\frac {2 i a^4}{d (a-i a \tan (c+d x))}+\frac {i a^3 \log (\cos (c+d x))}{d}-a^3 x \]

[In]

Int[Cos[c + d*x]^2*(a + I*a*Tan[c + d*x])^3,x]

[Out]

-(a^3*x) + (I*a^3*Log[Cos[c + d*x]])/d - ((2*I)*a^4)/(d*(a - I*a*Tan[c + d*x]))

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3568

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rubi steps \begin{align*} \text {integral}& = -\frac {\left (i a^3\right ) \text {Subst}\left (\int \frac {a+x}{(a-x)^2} \, dx,x,i a \tan (c+d x)\right )}{d} \\ & = -\frac {\left (i a^3\right ) \text {Subst}\left (\int \left (\frac {2 a}{(a-x)^2}+\frac {1}{-a+x}\right ) \, dx,x,i a \tan (c+d x)\right )}{d} \\ & = -a^3 x+\frac {i a^3 \log (\cos (c+d x))}{d}-\frac {2 i a^4}{d (a-i a \tan (c+d x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.11 (sec) , antiderivative size = 40, normalized size of antiderivative = 0.82 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx=-\frac {i a^3 \left (\log (i+\tan (c+d x))+\frac {2 a}{a-i a \tan (c+d x)}\right )}{d} \]

[In]

Integrate[Cos[c + d*x]^2*(a + I*a*Tan[c + d*x])^3,x]

[Out]

((-I)*a^3*(Log[I + Tan[c + d*x]] + (2*a)/(a - I*a*Tan[c + d*x])))/d

Maple [A] (verified)

Time = 2.85 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.02

method result size
risch \(-\frac {i a^{3} {\mathrm e}^{2 i \left (d x +c \right )}}{d}+\frac {2 a^{3} c}{d}+\frac {i a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(50\)
derivativedivides \(\frac {-i a^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )-3 a^{3} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 i a^{3} \left (\cos ^{2}\left (d x +c \right )\right )}{2}+a^{3} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(99\)
default \(\frac {-i a^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )-3 a^{3} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 i a^{3} \left (\cos ^{2}\left (d x +c \right )\right )}{2}+a^{3} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(99\)

[In]

int(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^3,x,method=_RETURNVERBOSE)

[Out]

-I/d*a^3*exp(2*I*(d*x+c))+2/d*a^3*c+I/d*a^3*ln(exp(2*I*(d*x+c))+1)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.73 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx=\frac {-i \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + i \, a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )}{d} \]

[In]

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^3,x, algorithm="fricas")

[Out]

(-I*a^3*e^(2*I*d*x + 2*I*c) + I*a^3*log(e^(2*I*d*x + 2*I*c) + 1))/d

Sympy [A] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 61, normalized size of antiderivative = 1.24 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx=\frac {i a^{3} \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \begin {cases} - \frac {i a^{3} e^{2 i c} e^{2 i d x}}{d} & \text {for}\: d \neq 0 \\2 a^{3} x e^{2 i c} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(d*x+c)**2*(a+I*a*tan(d*x+c))**3,x)

[Out]

I*a**3*log(exp(2*I*d*x) + exp(-2*I*c))/d + Piecewise((-I*a**3*exp(2*I*c)*exp(2*I*d*x)/d, Ne(d, 0)), (2*a**3*x*
exp(2*I*c), True))

Maxima [A] (verification not implemented)

none

Time = 0.38 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.27 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx=-\frac {2 \, {\left (d x + c\right )} a^{3} + i \, a^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - \frac {4 \, {\left (a^{3} \tan \left (d x + c\right ) - i \, a^{3}\right )}}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \]

[In]

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^3,x, algorithm="maxima")

[Out]

-1/2*(2*(d*x + c)*a^3 + I*a^3*log(tan(d*x + c)^2 + 1) - 4*(a^3*tan(d*x + c) - I*a^3)/(tan(d*x + c)^2 + 1))/d

Giac [A] (verification not implemented)

none

Time = 0.61 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.73 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx=\frac {-i \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + i \, a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )}{d} \]

[In]

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^3,x, algorithm="giac")

[Out]

(-I*a^3*e^(2*I*d*x + 2*I*c) + I*a^3*log(e^(2*I*d*x + 2*I*c) + 1))/d

Mupad [B] (verification not implemented)

Time = 3.64 (sec) , antiderivative size = 39, normalized size of antiderivative = 0.80 \[ \int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx=\frac {2\,a^3}{d\,\left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}-\frac {a^3\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{d} \]

[In]

int(cos(c + d*x)^2*(a + a*tan(c + d*x)*1i)^3,x)

[Out]

(2*a^3)/(d*(tan(c + d*x) + 1i)) - (a^3*log(tan(c + d*x) + 1i)*1i)/d